package com.nbsaas.boot.app.rest.convert;

import com.nbsaas.boot.app.data.entity.AppRoleMenu;
import com.nbsaas.boot.app.api.domain.response.AppRoleMenuResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 实体对象转化成响应对象
*/

public class AppRoleMenuResponseConvert  implements Converter<AppRoleMenuResponse,AppRoleMenu> {

    @Override
    public AppRoleMenuResponse convert(AppRoleMenu source) {
        AppRoleMenuResponse  result = new  AppRoleMenuResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getApp()!=null){
                        result.setApp(source.getApp().getId());
                    }
                    if(source.getRole()!=null){
                        result.setRole(source.getRole().getId());
                    }
                    if(source.getApp()!=null){
                        result.setAppName(source.getApp().getName());
                    }
                    if(source.getMenu()!=null){
                        result.setMenu(source.getMenu().getId());
                    }
        return result;
    }

}

